home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / kickups.swf / scripts / DefineSprite_37 / frame_4 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  1.1 KB  |  57 lines

  1. if(kicked == "0")
  2. {
  3.    score = "0";
  4. }
  5. score += "1";
  6. if(bestscore < score)
  7. {
  8.    bestscore = score;
  9. }
  10. kicked = "1";
  11. t += "0.1";
  12. oldx = x;
  13. oldy = y;
  14. x = getProperty("Ball", _X);
  15. y = getProperty("Ball", _Y);
  16. vx = (getProperty("Ball", _X) - getProperty("mouse", _X)) * "10" + (random("3") / "10" - "0.15");
  17. vy = - "125" + (y - getProperty("mouse", _Y));
  18. dx = getProperty("Ball", _X) - getProperty("mouse", _X);
  19. if("0" < dx)
  20. {
  21.    vy += dx;
  22. }
  23. else if(dx < "0")
  24. {
  25.    vy -= dx;
  26. }
  27. if(y < BallRadius)
  28. {
  29.    y = BallRadius;
  30.    vx *= elastic;
  31.    vy = - vy * elastic;
  32. }
  33. if("300" - BallRadius < y)
  34. {
  35.    y = "300" - BallRadius;
  36.    vx *= elastic;
  37.    vy = - vy * elastic;
  38. }
  39. if(x < BallRadius)
  40. {
  41.    x = BallRadius;
  42.    vx = - vx * elastic;
  43.    vy *= elastic;
  44. }
  45. if("400" - BallRadius < x)
  46. {
  47.    x = "400" - BallRadius;
  48.    vx = - vx * elastic;
  49.    vy *= elastic;
  50. }
  51. setProperty("Ball", _X, x);
  52. setProperty("Ball", _Y, y);
  53. setProperty("Ball", _rotation, x);
  54. setProperty("Ball", _xscale, "100");
  55. setProperty("Ball", _yscale, "100");
  56. gotoAndPlay(2);
  57.